<?php 
  require_once("konf.php"); 
   if(isSet($_REQUEST["sisestusnupp"])){
    $kask=$yhendus->prepare(
        "UPDATE parandused SET tehnik=? WHERE id=? ");
	$kask->bind_param("si", $_REQUEST["tehnik"],$_REQUEST["id"]);
	$kask->execute();
	$yhendus->close();
	header("Location: $_SERVER[PHP_SELF]?lisatudtehnik=$_REQUEST[tehnik]");
	exit();
  }
?>
<!doctype html>
<html>
  <head>
     <title>Haldurileht</title>
  </head>
  <body>
    <h1>Sisesta tehnik</h1>
    <?php
	  if(isSet($_REQUEST["lisatudtehnik"])){
	   echo "Lisati parandusele tehnik: $_REQUEST[lisatudtehnik] ";
	  }
    ?>	
	<form action="?">
	  <dl>
		<input type="hidden" name="id" value="<?php echo $_REQUEST["tellimuse_id"] ?>" ?>
	    
		
		<dd>
		<?php
		  $kask=$yhendus->prepare("SELECT knimi FROM kasutajad WHERE roll='tehnik'");
		  echo $yhendus->error;
		  $kask->bind_result($knimi);
		  $kask->execute();
		?>
		<dt>Tehnik:</dt>
		<select name='tehnik'>
		<?php
		  while($kask->fetch()){
		    echo "<option value='$knimi'>$knimi</option>";
			
		  }
		?>
				
			</select>
		</dd>
		
	    <dt><input type="submit" name="sisestusnupp" value="sisesta" /></dt>
	  </dl>
	</form>
	<a href='arvutiviga.php?tellimuse_id=$id'> Tagasikodulehele</a><br>
  </body>
</html>